package com.company;

public class Main {

    public static void main(String[] args) {
	int a[] = {1,55,23,21,3,1,3,43};
        int temp;
        int i,j;
        int index = a.length;
        for (index=a.length/2;index>0;index /= 2)
        {
            for (i=index;i<a.length;i++)
            {
                if (a[i]<a[i-index])
                {
                    temp = a[i];
                    a[i] = a[i-index];
                    for (j=i-index-1;j>0&&a[j]>temp;j--)
                    {
                        a[j+1]=a[j];
                    }
                    a[j+1]=temp;
                }
            }
        }
        for (int c=0;c<a.length;c++)
        {
            System.out.println(a[c]);
        }
    }
}
